Dispensers have been developed that dispense liquids or foams such as soap, lotions, sanitizers or other products. Some dispensers include an electromechanical pumping mechanism. The pumping mechanism may be actuated by a control system using logic. The control system may include a proximity sensor such as, an infrared, sonar, radar, laser, or optical sensor to detect an object placed near the sensor. In this regard, the hand of a user may be placed near the proximity sensor, which initiates the dispensing mechanism.